package com.zhixing.pay.controller;

import com.zhixing.common.utils.Res;
import com.zhixing.pay.domain.dto.TransactionQueryParams;
import com.zhixing.pay.domain.vo.TransactionRecordVO;
import com.zhixing.pay.service.TransactionRecordService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;

/**
 * 交易记录接口
 */
@Slf4j
@RestController
@RequestMapping("/transactionRecord")
@RequiredArgsConstructor
public class TransactionRecordController {

    private final TransactionRecordService transactionRecordService;

    /**
     * 分页获取交易记录
     * @param transactionQueryParams 查询参数
     * @return List<TransactionRecordVO> 交易记录列表
     */
    @GetMapping("/page")
    public Res<List<TransactionRecordVO>> getTransactionRecordByPage(@Validated TransactionQueryParams transactionQueryParams) {
        log.info("支付服务调用，获取交易记录，钱包id：{}", transactionQueryParams.getWalletId());
        return Res.ok(transactionRecordService.getTransactionRecord(transactionQueryParams));
    }
}
